using System;
using System.Collections.Generic;
using System.Text;

using Model;
using DAL;
using DAL.Impl;

namespace BLL.Impl
{
    public class EmployeeManagerImpl : EmployeeManager
    {
        private IEmployeeDAL dal;
        public EmployeeManagerImpl()
        {
            dal = EmployeeDAL.CreateIEmployeeDAL();
        }

        public static EmployeeManagerImpl CreateEmployeeManager()
        {
            return new EmployeeManagerImpl();
        }

        public Employee GetEmployee(Employee employee)
        {
            return dal.Get(employee);
        }

        public Employee Login(string loginName, string loginPassword)
        {
            Employee employee = dal.Login(loginName);
            if (null != employee)
            {
                if (employee.LoginPassword.Trim().Equals(loginPassword))
                    return employee;
            }
            return null;
        }

        public void Save(Employee employee)
        {
            dal.Save(employee);
        }

        public void Delect(Employee employee)
        {
            dal.Delect(employee);
        }
        public void Updata(Employee employee)
        {
            dal.Updata(employee);
        }
        public List<Employee> List()
        {
            return dal.List();
        }
    }
}
